package com.tian.recall.controller;

import com.tian.common.core.controller.BaseController;
import com.tian.common.core.page.TableDataInfo;

import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tian.recall.domain.Video;
import com.tian.recall.service.IVideoService;

/**
 * 个人视频 信息操作处理
 *
 * @author zcx
 * @date 2021-08-25 16:06:04
 */
@Controller
@RequestMapping("/recall/video")
public class VideoController extends BaseController {
    private String prefix = "recall/video";

	@Autowired
	private IVideoService videoService;

	/**
	 * 查询个人视频列表
	 */
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Video video){
		startPage();
        List<Video> list = videoService.selectVideoList(video);
		return getDataTable(list);
	}

	/**
	 * 新增保存个人视频
	 */
	@PostMapping("/add")
	@ResponseBody
	public String addSave(Video video){
		return toAjax(videoService.insertVideo(video));
	}

	/**
	 * 修改保存个人视频
	 */
	@PostMapping("/edit")
	@ResponseBody
	public String editSave(Video video){
		return toAjax(videoService.updateVideo(video));
	}

	/**
	 * 删除个人视频
	 */
	@PostMapping( "/remove")
	@ResponseBody
	public String remove(long id){
		return toAjax(videoService.deleteVideoById(id));
	}

	/**
	 * 删除个人视频
	 */
	@PostMapping( "/removes")
	@ResponseBody
	public String removes(String ids){
		return toAjax(videoService.deleteVideoByIds(ids));
	}

}
